// src/api/api.ts
import request from "@/utils/request";

/**
 * 获取订单列表
 * @param data
 * @returns
 */
export const getOrderListApi = (params: any) => {
  return request({
    url: "/api/order/list",
    method: "GET",
    params: params,
  });
};

/**
 * 新建或者更新订单
 * @param data
 * @returns
 */
export const saveOrUpdateOrderApi = (data: any) => {
  return request({
    url: "/api/order/saveOrUpdate",
    method: "POST",
    data: data,
  });
};

/**
 * 删除订单
 * @param id '订单Id'
 * @returns
 */
export const deleteOrderApi = (id: number) => {
  return request({
    url: `/api/order/delete/${id}`,
    method: "DELETE",
  });
};

/**
 * 获取单个订单
 * @param id
 * @returns
 */
export const getOrderByIdApi = (id: number) => {
  return request({
    url: `/api/order/getOrder/${id}`,
    method: "GET",
  });
};

/**
 * 配送员确认订单
 * @param data
 * @returns
 */
export const confirmOrderApi = (data: any) => {
  return request({
    url: "/api/order/confirmOrder",
    method: "POST",
    data: data,
  });
};

/**
 * 负责人确认订单
 * @param data
 * @returns
 */
export const confirmWarehouseApi = (data: any) => {
  return request({
    url: "/api/order/confirmWarehouse",
    method: "POST",
    data: data,
  });
};

/**
 * 负责人确认订单
 * @param data
 * @returns
 */
export const confirmStoreApi = (data: any) => {
  return request({
    url: "/api/order/confirmStore",
    method: "POST",
    data: data,
  });
};